$(document).ready(function(){

  $('#registerId').validate({

    rules:{
      'name':{
        required: true,
      },
      'phone':{
        required: true,
        number: true,
        minlength: 10,
        maxlenght: 10
      },
      'email':{
        required:true,
        email:true,
        remote:'ajax/check_email.php'
      },
      'age':{
        required:true,
        number: true
      },
      'gender':{
        required:true
      },
      'address':{
        required:true,
        minlength:10
      },
      'captcha':{
        required:true,
        remote:'ajax/check_captcha.php'
      }
    },
    messages:{
      'name':{
          required: 'Name is required',
      },
      'phone':{
        required: 'Contact No. is required',
        number: 'Enter valid number',
        minlength: $.format("Contact No. minimum should be {0} characters long."),
        maxlenght: $.format("Contact No. maximum should be {0} characters long.")
      },
      'email':{
          required: 'Email is required',
          email: 'Please enter valid email id',
          remote: 'Email alreday exists'
      },
      'age':{
        required: 'Age is required',
        number: 'Enter valid age'
      },
      'gender':{
          required: 'Please select your gender',
      },
      'address':{
          required: 'Address is required',
          minlength: $.format("Address should be {0} characters long.")
      },

    },// end of messages
    
  }); // end of validate
}); // end of jquery
